import java.util.Scanner;
public class One {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int l=in.nextInt();
        int r=in.nextInt();
        int ret=0;
        for(int i=l;i<=r;i++){
            int tmp=i;
            while(tmp!=0){
                if(tmp%10==2)
                    ret++;
                tmp/=10;
            }
        }
        System.out.println(ret);
    }
}
